<?php ob_start();?>
<?php

session_start ();
$root = $_SERVER ['DOCUMENT_ROOT'];
//include($root.'/standart/head.php');
include ($root . '/standart/dateHeader.php');
include($root.'/cart/ShoppingCart.class.php');
include($root.'/cart/MenuItem.class.php');


if (isset ( $_GET ["ACTION"] )) {
	if ($_GET ["ACTION"] == "ADD") {
		if (isset ($_GET ["MENU_ID"])) {
			$shoppingCart = new Shopping_Cart("sepet");
			$shoppingCart->addItem($_GET ["MENU_ID"], $_GET ["QUANTITY"]);
			echo $shoppingCart->getAllQuantity();
		}
	}
	else if($_GET ["ACTION"] == "CHANGEQUANTITY"){
		if (isset($_GET ["MENU_ID"]) && isset($_GET["QUANTITY"])){
			$shoppingCart = new Shopping_Cart("sepet");
			$shoppingCart->updateQuantity($_GET ["MENU_ID"], $_GET["QUANTITY"]);
			echo $shoppingCart->getAllQuantity();
		}
	}
	else if($_GET ["ACTION"] == "EMPTYCART"){
			$shoppingCart = new Shopping_Cart("sepet");
			$shoppingCart->emptyCart();
			echo $shoppingCart->getAllQuantity();
	}
	else if ($_GET ["ACTION"] == "REMOVE") {
		if (isset ($_GET ["MENU_ID"])) {
			$shoppingCart = new Shopping_Cart("sepet");
			$shoppingCart->removeItem($_GET ["MENU_ID"]);
			echo $shoppingCart->getAllQuantity();
		}
	}
}
?>
<?php ob_end_flush(); ?>